1*e9cbe144SAndrew Rist /************************************************************** 2*e9cbe144SAndrew Rist * 3*e9cbe144SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*e9cbe144SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*e9cbe144SAndrew Rist * distributed with this work for additional information 6*e9cbe144SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*e9cbe144SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*e9cbe144SAndrew Rist * "License"); you may not use this file except in compliance 9*e9cbe144SAndrew Rist * with the License. You may obtain a copy of the License at 10*e9cbe144SAndrew Rist * 11*e9cbe144SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*e9cbe144SAndrew Rist * 13*e9cbe144SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*e9cbe144SAndrew Rist * software distributed under the License is distributed on an 15*e9cbe144SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*e9cbe144SAndrew Rist * KIND, either express or implied. See the License for the 17*e9cbe144SAndrew Rist * specific language governing permissions and limitations 18*e9cbe144SAndrew Rist * under the License. 19*e9cbe144SAndrew Rist * 20*e9cbe144SAndrew Rist *************************************************************/ 21*e9cbe144SAndrew Rist 22*e9cbe144SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #include <entity.hxx> 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include <string.h> 27cdf0e10cSrcweir 28cdf0e10cSrcweir 29cdf0e10cSrcweir namespace DOM 30cdf0e10cSrcweir { 31cdf0e10cSrcweir CEntity(CDocument const & rDocument,::osl::Mutex const & rMutex,xmlEntityPtr const pEntity)32cdf0e10cSrcweir CEntity::CEntity(CDocument const& rDocument, ::osl::Mutex const& rMutex, 33cdf0e10cSrcweir xmlEntityPtr const pEntity) 34cdf0e10cSrcweir : CEntity_Base(rDocument, rMutex, 35cdf0e10cSrcweir NodeType_ENTITY_NODE, reinterpret_cast<xmlNodePtr>(pEntity)) 36cdf0e10cSrcweir , m_aEntityPtr(pEntity) 37cdf0e10cSrcweir { 38cdf0e10cSrcweir } 39cdf0e10cSrcweir IsChildTypeAllowed(NodeType const nodeType)40cdf0e10cSrcweir bool CEntity::IsChildTypeAllowed(NodeType const nodeType) 41cdf0e10cSrcweir { 42cdf0e10cSrcweir switch (nodeType) { 43cdf0e10cSrcweir case NodeType_ELEMENT_NODE: 44cdf0e10cSrcweir case NodeType_PROCESSING_INSTRUCTION_NODE: 45cdf0e10cSrcweir case NodeType_COMMENT_NODE: 46cdf0e10cSrcweir case NodeType_TEXT_NODE: 47cdf0e10cSrcweir case NodeType_CDATA_SECTION_NODE: 48cdf0e10cSrcweir case NodeType_ENTITY_REFERENCE_NODE: 49cdf0e10cSrcweir return true; 50cdf0e10cSrcweir default: 51cdf0e10cSrcweir return false; 52cdf0e10cSrcweir } 53cdf0e10cSrcweir } 54cdf0e10cSrcweir 55cdf0e10cSrcweir /** 56cdf0e10cSrcweir For unparsed entities, the name of the notation for the entity. 57cdf0e10cSrcweir */ getNotationName()58cdf0e10cSrcweir OUString SAL_CALL CEntity::getNotationName() throw (RuntimeException) 59cdf0e10cSrcweir { 60cdf0e10cSrcweir OSL_ENSURE(false, 61cdf0e10cSrcweir "CEntity::getNotationName: not implemented (#i113683#)"); 62cdf0e10cSrcweir return OUString(); 63cdf0e10cSrcweir } 64cdf0e10cSrcweir 65cdf0e10cSrcweir /** 66cdf0e10cSrcweir The public identifier associated with the entity, if specified. 67cdf0e10cSrcweir */ getPublicId()68cdf0e10cSrcweir OUString SAL_CALL CEntity::getPublicId() throw (RuntimeException) 69cdf0e10cSrcweir { 70cdf0e10cSrcweir ::osl::MutexGuard const g(m_rMutex); 71cdf0e10cSrcweir 72cdf0e10cSrcweir OUString aID; 73cdf0e10cSrcweir if(m_aEntityPtr != NULL) 74cdf0e10cSrcweir { 75cdf0e10cSrcweir aID = OUString((sal_Char*)m_aEntityPtr->ExternalID, strlen((char*)m_aEntityPtr->ExternalID), RTL_TEXTENCODING_UTF8); 76cdf0e10cSrcweir } 77cdf0e10cSrcweir return aID; 78cdf0e10cSrcweir } 79cdf0e10cSrcweir 80cdf0e10cSrcweir /** 81cdf0e10cSrcweir The system identifier associated with the entity, if specified. 82cdf0e10cSrcweir */ getSystemId()83cdf0e10cSrcweir OUString SAL_CALL CEntity::getSystemId() throw (RuntimeException) 84cdf0e10cSrcweir { 85cdf0e10cSrcweir ::osl::MutexGuard const g(m_rMutex); 86cdf0e10cSrcweir 87cdf0e10cSrcweir OUString aID; 88cdf0e10cSrcweir if(m_aEntityPtr != NULL) 89cdf0e10cSrcweir { 90cdf0e10cSrcweir aID = OUString((sal_Char*)m_aEntityPtr->SystemID, strlen((char*)m_aEntityPtr->SystemID), RTL_TEXTENCODING_UTF8); 91cdf0e10cSrcweir } 92cdf0e10cSrcweir return aID; 93cdf0e10cSrcweir } getNodeName()94cdf0e10cSrcweir OUString SAL_CALL CEntity::getNodeName()throw (RuntimeException) 95cdf0e10cSrcweir { 96cdf0e10cSrcweir ::osl::MutexGuard const g(m_rMutex); 97cdf0e10cSrcweir 98cdf0e10cSrcweir OUString aName; 99cdf0e10cSrcweir if (m_aNodePtr != NULL) 100cdf0e10cSrcweir { 101cdf0e10cSrcweir const xmlChar* xName = m_aNodePtr->name; 102cdf0e10cSrcweir aName = OUString((sal_Char*)xName, strlen((char*)xName), RTL_TEXTENCODING_UTF8); 103cdf0e10cSrcweir } 104cdf0e10cSrcweir return aName; 105cdf0e10cSrcweir } getNodeValue()106cdf0e10cSrcweir OUString SAL_CALL CEntity::getNodeValue() throw (RuntimeException) 107cdf0e10cSrcweir { 108cdf0e10cSrcweir return OUString(); 109cdf0e10cSrcweir } 110cdf0e10cSrcweir } 111