Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Attribute with HTML Content
Attribute with HTML Content [message #1778466] Thu, 14 December 2017 14:51 Go to next message
M V is currently offline M VFriend
Messages: 31
Registered: July 2017
Member
Hello,

I have an XML File I read into an EMF model. I reverse engineer the schema of this XML and use this as basis to generate the ecore model. Now i have some special part in this XML:
                    <AttributeList>
                      <Culture>en-US</Culture>
                      <Text><body><p>text</p></body></Text>
                    </AttributeList>


The <Text></Text> block contains html tags but it can also contains plain text. My goal is it that the content of the text block is parsed into the attribute as String.

My problem is that the emf parser try to parse the body as feature. How can I tell them that he should ignore the content between the <Text></Text> or maybe can I escape it? I don't want to change or manipulate the original xml File.

Thanks for Help
Re: Attribute with HTML Content [message #1778479 is a reply to message #1778466] Thu, 14 December 2017 16:48 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
You can't do that. The SAX parser itself will necessarily parse the elements within <Text></Text> so the result must always be a structure representation. You can use a containment feature of type anyType from the XMLType model, but you'll never get just a string value out of nested XML elements.

Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Attribute with HTML Content [message #1778481 is a reply to message #1778479] Thu, 14 December 2017 17:00 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Have you considered XHTML?

Regards

Ed Willink
Re: Attribute with HTML Content [message #1778500 is a reply to message #1778481] Fri, 15 December 2017 07:28 Go to previous message
M V is currently offline M VFriend
Messages: 31
Registered: July 2017
Member
Thanks for the quick response.

Ed Merks wrote on Thu, 14 December 2017 16:48
You can't do that. The SAX parser itself will necessarily parse the elements within <Text></Text> so the result must always be a structure representation. You can use a containment feature of type anyType from the XMLType model, but you'll never get just a string value out of nested XML elements.


AnyType is a good advice. I have try this and it solve my problem. It is important for me that the original structur is keep. That I can not get a direct String attribute is not so important it only would be a "nice to have" goal for me.

Ed Willink wrote on Thu, 14 December 2017 17:00
Hi
Have you considered XHTML?
Regards
Ed Willink


In the <Text></Text> Block? No I have no influence on the content of this Tags.
Previous Topic:[CDO] Optimistic Concurrency Control - Reg.
Next Topic:Dealing with model structure changes
Goto Forum:
  


Current Time: Thu Apr 18 03:12:19 GMT 2024

Powered by FUDForum. Page generated in 0.02039 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top