entities

How to escape the character entities in XML?

I want to pass XML as a string in an XML attribute. <activity evt="&lt;FHS&gt; &lt;act&gt; &lt;polyline penWidth=&quot;2&quot; points=&quot;256,435 257,432 &quot;/&gt; &lt;/act&gt; &lt;/FHS&gt;" /> Here the "evt" attribute is the XML string, so escaping all the less-than, greater-than, etc characters by the appr...

How to make Nokogiri transparently return un/encoded Html entities untouched?

How can I use Nokogiri with having html entities (like German umlauts) untouched? I.e.: # this is fine node = Nokogiri::HTML.fragment('<p>&ouml;</p>') node.to_s # => '<p>&ouml;</p>' # this is not node = Nokogiri::HTML.fragment('<p>ö</p>') node.to_s # => '<p>&ouml;</p>' # this is what I need node = Nokogiri::HTML.fragment('<p>ö</p>') ...

How can I read malformed XML (unencoded entities) with Perl?

I'm trying to parse an XML file I get from an external source but am having problems because there are unencoded XML entities in the text nodes. Essentially, I'm asking the same question as this, but for Perl instead of PHP. <report> <company>A & W</company> <company>Some Other Company with a < in Inc.</company> </report> I...

Retrieve entities with children per one sql call. ADO.NET Entity framework

Hello everybody, I have two tables: A & B B { B1: Field1, B2: Field2, ... } A { Children: List of B, A1: Field1, A2: Field2, } I want to retrieve "A" entities with related "B" entities like this: DataContext.A.Select( a => new MySubset( A1 = a.A1, Children = a.Children.Select(b => b.B1).ToList())...

Alternative to System.Web.HttpUtility.HtmlEncode/Decode?

Is there any 'slimmer' alternative to the System.Web.HttpUtility.HtmlEncode/.Decode functions in .net 3.5 (sp1)? A separate library is fine.. or even 'wanted', at least something that does not pull in a 'whole new world' of dependencies that System.Web requires. I only want to convert a normal string into its xml/xhtml compliant equival...

Converting HTML entities to Unicode character in JavaScript?

Sample Conversions &amp; -> `&` &gt; -> `>` Any small library function that can handle this? ...

Programmatically loading Entity classes with JPA 2.0?

With Hibernate you can load your Entity classes as: sessionFactory = new AnnotationConfiguration() .addPackage("test.animals") .addAnnotatedClass(Flight.class) .addAnnotatedClass(Sky.class) .addAnnotatedClass(Person.class) .addAnnotatedCl...

What's the best way to store custom objects in relational database?

I have my objects with their properties. Objects could change their structure: properties may be added/removed/changed. Objects could be absolutely dropped. So object's metadata (description, classes, call them like you want :) )could be changed. The database should store objects schemas and instances of these objects. What's the best ...

PHP simplexml Entities

What's going one here? $string = <<<XML <?xml version="1.0" encoding="UTF-8"?> <album> <img src="002.jpg" caption="w&aacute;ssup?" /> </album> XML; $xml = simplexml_load_string($string); // $xmlobj = simplexml_load_file("xml.xml"); // same thing echo "<pre>"; var_dump($xml); echo "</pre>"; Error: Warning: simplexml_...

Getting XML Numbered Entities with PHP 5 DOM

Hello guys, I am new here and got a question that is tricking me all day long. I've made a PHP script, that reads a website source code through cURL, then works with DOMDocument class in order to generate a sitemap file. It is working like a charm in almost every aspect. The problem is with special characters. For compatibility reaso...

PHP - DOM class - numbered entities and encodings problem

Hi guys, I'm having some difficult with PHP DOM class. I am making a sitemap script, and I need the output of $doc->saveXML() to be like <?xml version="1.0" encoding="UTF-8"?> <root> <url> <loc>http://www.somesite.com/servi&amp;#xE7;os/redesign&lt;/loc&gt; </url> </root> or <?xml version="1.0" encoding="UTF-8"?> <ro...

Linq2SQL, Entities: Middle Tier or Data Access Layer

Folks, In a standard 3-tier architecture, where would you put your Linq2SQL dbml file? Is your answer the same for a ado.net entity data model? If the dbml file is in the middle tier, then do you have a data layer? Regards, Brett ...

DDD: Where to create entity objects?

I have three entities that must interact: User, SupportTicketand PhoneConversation. When someone calls in requesting help, the User should have a SupportTicket assigned to him, with a PhoneConversation assigned to the Ticked describing the call. My question is: In what entity should I put the method CreatePhoneSupportTicket() that crea...

How to force javax xslt transformer to encode national characters using utf-8 and not html entities?

I'm working on filter that should transform an output with some stylesheet. Important sections of code looks like this: PrintWriter out = response.getWriter(); ... StringReader sr = new StringReader(content); Source xmlSource = new StreamSource(sr, requestSystemId); transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); transforme...

Are there any good patterns for handling list of entities

In "DDD" what is the best patterns for handling different versions of your entities, e.g. Entities in a list vs the full object. I would like to avoid the overhead of getting properties I do not need when displaying the entities in a list Would you have a separate entity type used in lists or just fill up your full entity type partially...

Insert html-entities in xslt

I have some XMLs that contain character hex codes, e.g. it like this: <char hex="AB"/> Now I want to xslt transform for display in the browser: <xsl:value-of select="concat('&amp;#x', /char/@hex, ';', '')"/> However, the output in the browser is &amp;#xAB; and not as I expected &#xAB; so the browser does not display the character for...

Entity Framework 4.0 Creating a new entity derived from other entities

I currently have a complex entity relationship setup based on my data structure in sql server 2008. What I'm trying to do I would think would be ridiculously simple but I'm pulling my hair out and have spent days trying to figure it out. I have an Address and AddressType table which are joined on addressTypeID. There are 2 AddressType...

Value Objects Vs Entities...

Quick question... When approaching something like an email address the immediate idea is to treat this as a value object. If we have a number of entities though, say a customer, a contact, and a supplier that are referencing the same email address, it is conceivable that when we change a customer's email address we may want the custome...

Core data: can NSFetchedResultsController fetch two different entities?

I am working on an iPhone app, and in a particular view I need to load two different entities: One that will populate a UITableView, and another that will populate a UITextView. Is it possible to fetch both properties using a single NSFetchedResultsController? Or do I need to use two different NSFetchedResultsController? Any ideas on...

linq System.ObjectDisposedException

Hi, i have a problem with some data i retrievied from db with linq. When I try to access data I obtain the following exception: System.ObjectDisposedException : The istance of ObjectContext was deleted and is not possible to use it again for action that need a connection. This is the code: using (ProvaDbEntities DBEntities = new ProvaDb...