Вопрос

i try to read from a XML document via the CodeSynthesis XSD generated files (.cxx/.hxx) and have this code:

1-> char* xmlFile = "C:\\Work\\MPRawDataExample.xml";       
2-> auto_ptr<MPRawDataFile> f = MPRawDataFile_(xmlFile);
3-> cout << f->MPRawDataFileMeta().PatientID() << endl;

Now on line 2 following error occurs:

unterminated entity reference "D" thrown from the xsd::cxx::tree::error_handler<C>

The file really exists there, also checked out this but hasnt helped

Has maybe someone a solution for this or another way how to read out from a XML-file?

-> Solved. XSD-file wasnt referenced correctly in the xml file, but now this below:


Update:

wrong part in XML-file:

    <AdditionalInformation>
        <Info name="Ag" value="225.0/220.5"></Info>
        <Info name="Vel" value="24.0/22.1"></Info>
        <Info name="CC" value="0.999"></Info>
        <Info name="AUC" value="1026/1159"></Info>
        <Info name="Abbr. from mean" value="1.987"></Info>
        <Info name="Base" value="1484/1501"></Info>
        <Info name="End" value="1787/1795"></Info>
    </AdditionalInformation>

restrictions from xsd:

<xs:simpleType name="ST_Info">
    <xs:restriction base="xs:string">
        <xs:enumeration value="0.999"/>
        <xs:enumeration value="1.987"/>
        <xs:enumeration value="1026/1159"/>
        <xs:enumeration value="1484/1501"/>
        <xs:enumeration value="1787/1795"/>
        <xs:enumeration value="225.0/220.5 "/>
        <xs:enumeration value="24.0/22.1"/>
    </xs:restriction>
</xs:simpleType>

for each <Info> now i get the Error value "" not in enumeration

but the Value's that are in the XML are in the restriction-enumeration? or do i missunderstand something?

Это было полезно?

Решение

Turning my comments into an answer

Both the problems you list seem to be problems with the XML file itself, not with the parsing code. The first one looks like there's an entity reference &D without a matching ; or something.

The second one probably means that the restriction applies to the contents of the Item element (the text between its opening <Item> and closing </Item> tags), not to its attribute named value).

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top