Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

How to access embedded xml documents as strings #842

Unanswered
loopj asked this question in Q&A
Discussion options

I'm working with a funky XML RPC API that will sometimes return embedded XML documents inside other elements, without applying any special encoding. These embedded documents often contain xml comments and processing instructions.

For example, this XML document that embeds a full XML schema inside the <TypeInfo> element:

<?xml version="1.0" encoding="UTF-8"?>
<Types>
 <TypeName>MyType</TypeName>
 <TypeInfo>
 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
 <!-- some full XML schema document here -->
 </xs:schema>
 </TypeInfo>
</Types>

For my use cases, I typically want to access/store these embedded documents as text, rather than fully parsed XML nodes, eg:

my_model.type_name
> 'MyType'
print(my_model.type_info)
> '<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">\n\t<!-- some full XML schema document here -->\n</xs:schema>'

Is this possible with xsdata? If so what would an example model look like?

You must be logged in to vote

Replies: 1 comment

Comment options

Here we have a similar issue, but embedded documents are signed xml documents, in this case it is important to treat them differently to prevent serialization/deserialization from somehow invalidating the signature of the document.
I'm also interested in whether it's possible to handle this in some way directly in xsdata.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /